<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<% add_crumb t('crumbs.faculty_journal', "Faculty Journal") %>
<% @active_tab = "faculty-journal" %>
<% content_for :page_title do %><%= t :page_title, "Faculty Journal" %><% end %>
<h1 class="screenreader-only"><%= t :journal_header, "Faculty Journal" %></h1>
<p><%= @is_course ? t(:details_this_course, "Last Faculty Journal entries for students currently enrolled in this course.") :
       t(:details_a_course, "Last Faculty Journal entries for students currently enrolled in a course.") %></p>

<%= will_paginate(@users, :style=>"margin-bottom: 1em;") %>

<% css_bundle("syllabus") %>
<table id="syllabus">
  <thead>
    <tr>
      <th><%= t 'headers.student', "Student" %></th>
      <th><%= t 'headers.last_entry', "Last Faculty Journal Entry" %></th>
      <th><%= t 'headers.current_courses', "Current Courses" %></th>
    </tr>
  </thead>
  <% @users.each do |user| %>
    <tr class="date">
      <td class="details"><a href="<%= user_user_notes_path(user)%>"><%= user.last_name_first %></a></td>
      <td style="text-align:left;"><%= datetime_string(user.try_rescue(:last_user_note)) || t("Never") %></td>
      <td class="courses" style="text-align:left;">
        <% user.courses.each_with_index do |course, i| %><%= ", " if i > 0 %><a href="<%= course_user_notes_path(course) %>"><%= course.short_name %></a><% end %>
      </td>
    </tr>
  <% end %>
</table>

<%= will_paginate(@users, :style=>"margin-top: 1em;") %>
